package com.santu.edu.supporter.biz.team.dao;

import com.santu.edu.supporter.biz.team.dao.mapper.UserTeamMapper;
import com.santu.edu.supporter.biz.team.pojo.dto.UserTeamDTO;
import com.santu.edu.supporter.biz.team.pojo.po.UserTeamPO;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Repository;

/**
 * @author luoyaoqi
 * @createTime 2024/3/7
 * @description
 */
@Repository
@RequiredArgsConstructor
public class UserTeamDao {

    private final UserTeamMapper userTeamMapper;

    public void addTeam(UserTeamDTO dto) {
        UserTeamPO item = UserTeamPO.createItem(dto);
        userTeamMapper.insertOne(item);
    }

    public UserTeamDTO getTeamById(String teamId) {
        UserTeamPO item = userTeamMapper.selectTeamById(teamId);
        return UserTeamDTO.createItem(item);
    }
}
